
	** Uganda
	** Clean wave 6
		
	** Urban status
	
		use "$dir/rawdata/LSMS Uganda/2018/HH/GSEC1.dta", clear
		gen w6_urban=urban==1
		
		keep hhid w6_*
		
		tempfile urban
		save `urban', replace
		
	** Roster
		use "$dir/rawdata/LSMS Uganda/2018/HH/GSEC2.dta", clear
		
		gen w6_female=h2q3==2 if !missing(h2q3)
		gen w6_age=h2q8
		gen w6_married=(h2q10==1 | h2q10==2) if !missing(h2q10)
		
		gen w6_inhh=h2q7<=4
		
		bys hhid: egen w6_hh_size=total(w6_inhh)
		ren PID indiv
		
		keep hhid indiv w6_*
		tempfile roster
		save `roster', replace
		
	** Illness or injury
	
		use "$dir/rawdata/LSMS Uganda/2018/HH/GSEC5.dta", clear
	
		gen w6_illinj=s5q04==1 if !missing(s5q04)
		gen w6_illinjstopactivities=s5q06>0 if !missing(s5q06)
		replace w6_illinjstopactivities=0 if w6_illinj==0
		
		ren PID indiv 
		
		keep hhid indiv w6_*		
		tempfile illinj
		save `illinj', replace
		
	** Employment 
		
		use "$dir/rawdata/LSMS Uganda/2018/HH/GSEC8.dta", clear
		
		gen w6_work_outsideHH=s8q04==1 if !missing(s8q04)
		
		gen w6_work_bizHH=(s8q06==1 | s8q08==1) if (!missing(s8q06) | !missing(s8q08))
		
		gen w6_work_agHH=(s8q12==1) if !missing(s8q12)
		
		egen w6_worked_last7days=rowmax(w6_work_outsideHH w6_work_agHH w6_work_bizHH)
		
		egen w6_work_hrs=rowtotal(s8q36a s8q36b s8q36c s8q36d s8q36e s8q36f s8q36g s8q43a s8q43b s8q43c s8q43d s8q43e s8q43f s8q43g), mi // inludes working on a household business, agriculture, etc.
		
		ren PID indiv
		keep hhid indiv w6_*
		
		tempfile employment
		save `employment', replace

	** Disabilities
	
		*n/a		
		
	** Merge and save
	
		use `roster', clear
		merge 1:1 hhid indiv using `illinj', gen(merge_illinj)
		merge 1:1 hhid indiv using `employment', gen(merge_employment)
		merge m:1 hhid using `urban', gen(merge_urban)
		
		save "$dir/data/uga_w6_individual.dta", replace
